$(document).ready(function(){
		//主菜单
		$("#main-nav > li > [clickself='1']").click(function(){
			$("#main-nav > li > [clickself='1']").attr("class","nav-top-item");												 
			var classFla=$(this).attr("class");
			$(this).attr("class",classFla+" current");
			
		});	
		//选项
		$("#main-nav > li > ul > li >[clickself='1']").click(function(){
			$("#main-nav > li >  ul > li > [clickself='1']").attr("class","");											
			var classFla=$(this).attr("class");
			$(this).attr("class",classFla+" current");
		});	
		//内存监控
		var memUse= $("#memUse").html();//内存已用
		var memMax= $("#memMax").html();//内存最大
		var mempec= Math.round((memUse/memMax)*100);//内存百分比计算
		
		$("#mem").css("width",mempec+"%");
		if(mempec<50){
			$("#mem").css("background-color","green");
		}
		else if(mempec>=50 && mempec<=80){
			$("#mem").css("background-color","yellow");
		}
		else if(mempec>80){
			$("#mem").css("background-color","red");
		}
		
		//记录选中标记
		//确保在jdstudio_content_tr层内，并且mvflagBycheck开启
		//用法详情见publishCompanyList_sub.jsp
		$("#jdstudio_content_tr>tr[mvflagBycheck='true']").mousemove(function(){
			$(this).css("background-color","#D9D9D9").css("border-bottom","solid 1px #fff");
		}).mouseout(function(){
			var ischecked=$("td > input[type='checkbox']",$(this)).is(':checked');
			if(ischecked==false){
				$(this).css("background-color","#FFF");
			}
		}).click(function(){
			var checkobj=$("td > input[type='checkbox']",$(this));
			var trbackgroundColor=$(this).css("background-color");
			if(checkobj.is(':checked')==false){
				checkobj.attr('checked', !checkobj.is(':checked'));   
				$(this).css("background-color","#D9D9D9").css("border-bottom","solid 1px #fff");
			}else{
				checkobj.attr('checked', !checkobj.is(':checked'));    
				$(this).css("background-color","#FFF");
			}
		})
		
		//input为空检测
		//checkSelf与checkSelfNotice必须同级
		//详见publishCompanyAdd_sub.jsp
		$("input[checkSelf='true']").each(function(){
			$(this).blur(function(){
				if($(this).val()==""){
						$(this).attr("style","border:1px solid red");
						$(this).parent().parent().find("[checkSelfNotice='true']").html("<span style='color:red'>为空检测失败！</span>");
					}else{
						$(this).removeAttr("style","border:1px solid red");
						$(this).parent().parent().find("[checkSelfNotice='true']").html("<span style='color:green'>OK!</span>");
					}
				});
			});
			 

})

function memRefresh(){
	window.location.href="/jadestudio/portal.do";
}

function OpenNewWindow(url,width,height){
	var nwin = window.open(url,'calendar','width='+width+',height='+height+',titlebar=no,statusbar=no,menubar=no,resizable=no,scrollbars=no,location=no,scollbars=no'); 
}


